package com.neouton.crm.sales.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.neouton.crm.cm.entity.SalesCostMigrateVO;
import com.neouton.crm.entity.SysUserEntity;
import com.neouton.crm.sales.entity.SalesAuditBackVO;
import com.neouton.crm.sales.entity.SalesAuditVO;
import com.neouton.crm.sales.entity.SalesStageVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author 巾凡
* @description 针对表【sales_audit(审批表)】的数据库操作Mapper
* @createDate 2022-11-09 09:34:07
* @Entity com.neouton.crm.sales.entity.SalesAudit
*/
@Mapper
public interface SalesAuditMapper extends BaseMapper<SalesAuditVO> {

    /**
     * 查询审核信息
     * @param salesRelationId
     * @param auditClass
     * @return
     */
    List<SalesAuditVO> queryAuditInfo(@Param("salesRelationId") Integer salesRelationId, @Param("auditClass") Integer auditClass);

    List<SalesAuditVO> queryOpInfoByPM(@Param("projectManageId") Integer projectManageId);
    SalesAuditVO queryAuditByWorkId(@Param("workId")Integer workId);

    SalesAuditVO queryHistoryAuditInfoByApprovalId(@Param("workId")Integer workId);

    /**
     *
     * @param id
     * @return
     */
    int deleteByPrimaryKey(Long id);

    int deleteByRelationId(@Param("salesRelationId") Integer salesRelationId, @Param("auditClass") Integer auditClass);

    int insert(SalesAuditVO record);

    int insertSelective(SalesAuditVO record);

    SalesAuditVO selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(SalesAuditVO record);

    int updateByPrimaryKey(SalesAuditVO record);

    IPage<SalesAuditVO> queryCmAudit(@Param("page") IPage page, @Param("record") SalesAuditVO record, @Param("userList") List<SysUserEntity> userList);

    IPage<SalesAuditVO> queryCmAuditInfo(@Param("page") IPage page, @Param("record") SalesAuditVO record);

    List<SalesAuditVO> queryCmAudit(@Param("record") SalesAuditVO record, @Param("userList") List<SysUserEntity> userList);

}
